{include file="public/layout" /}
<body>
  <link rel="stylesheet" href="__SKIN__/css/template.css?v={$version}" media="all">
  <div class="layui-fluid layadmin-maillist-fluid house_template">
    <div class="layui-card"  >
      <div class="head-oper">
        <div class="fl"></div>
        <div class="fr "></div>
        <div class="layui-card-body">
          <div class="layui-row layui-col-space15">
            {volist name='$list' id='vo'}
            <div class="layui-col-md2 layui-col-sm4">
              <div class="cmdlist-container"> 
                <a href="{:url('Filemanager/lists', array('activepath'=>replace_path($vo.filepath)))}">
                  <img width="242" height="200" src="{$vo.preview}?t={php}echo time();{/php}">
                </a>
                <div class="cmdlist-text"> 
                  <span class="info"><a href="{:url('Filemanager/lists', array('activepath'=>replace_path($vo.filepath)))}">{$vo.title} <i style="color: #3366cc; font-size: 12px; font-weight: normal">[管理]</i></a></span> 
                  <span>
                  <div class="layui-form">
                    <label>状态：</label>
                    <input type="checkbox" lay-skin="switch" lay-filter="is_default" lay-text="开启|关闭" data-theme="{$vo.filename}" {eq name='$vo.is_default' value='1'}checked{/eq}>
                  </div>
                  </span>
                  <span>风格名称：{$vo.config.mbname}</span> 
                  <span>系统版本：{$vo.config.cmsversion}</span>
                </div>
              </div>
            </div>
            {/volist}
          </div>
        </div>
      </div>
    </div>
  </div>
  <script>
      layui.config({
          base: '__SKIN__/' //静态资源所在路径
          ,version: '{$version}'
      }).extend({
          index: 'lib/index' //主入口模块
      }).use(['index', 'table'], function(){
          var $ = layui.$
              ,form = layui.form
              ,table = layui.table;

          //开启关闭
          form.on('switch(is_default)', function(data){
              var theme = $(this).data('theme');
              if (data.elem.checked){
                  value = 1;
              }else{
                  value = 0;
              }
              var load = layer_loading();
              $.ajax({
                  type : 'post',
                  url : "{:url('Filemanager/ajax_set_theme')}",
                  data : {theme:theme,_ajax:1},
                  dataType : 'json',
                  success : function(res){
                      layer.close(load); //关闭loading
                      if(res.code == 1){
                          window.location.reload();
                      }else{
                          showErrorMsg(res.msg);
                      }
                  },
                  error: function(e){
                      layer.close(load); //关闭loading
                      showErrorAlert();
                  }
              });
              return false;
          });
      });
  </script>
{include file="public/footer" /}